﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="ES_Inquire.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.ES_Inquire" %>

<%@ Register src="../Controls/MasterYear.ascx" tagname="MasterYear" tagprefix="uc1" %>
<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc2" %>

<asp:Content 
    ID="Content1" 
    runat="server" 
    contentplaceholderid="ContentPlaceHolder1">   

       <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">        
            <script type="text/javascript">
               
                   function onTextChange(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }
 
            </script>
        
    </telerik:RadCodeBlock>      
            
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="btnSearch">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="btnShowAll">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="rcb1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                            <telerik:AjaxUpdatedControl ControlID="rcb1" /> 
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />

            <table>
            <tr>
            <td width="280" valign = "top">                
                <uc2:user ID="user1" runat="server" />                
            </td>
            <td width="20" >
            </td>
            <td>
            <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
            <div class="moduleDivSlim700">
                    <div class="moduleDivBottom700">
                         <asp:Panel ID="PanelFilter" runat="server" Width="700px" ScrollBars="Auto">
                            <table align = "center" width = "650px">
                                    <tr>
                                        <td align="right" style="width: 325px" >แบบแสดงความจำนงประจำปี : 
                                            <uc1:MasterYear ID="cbYear" runat="server" />
                                        </td>
                                        <td>
                                            <asp:Button ID="btnFilter" runat="server" onclick="btnFilter_Click" 
                                                Text="กรองข้อมูล" />
                                        </td>
                                        
                                       <td>
                                            &nbsp;</td>
                                    </tr>
                                </table>
                        </asp:Panel>
                    </div>
                </div>
            </td>
          </tr>
  
          </table>

        <div class="moduleDivSlim1000x450">
        <div class="moduleDivBottom1000">
            <table align = "center">
            <tr>
            <td class ="tableHeader">
                รายการแบบแสดงความจำนง
                <asp:Label ID="lblEmpSeq" runat="server" 
                        Text='<%# DataBinder.Eval( Container, "DataItem.Employee.Sequence"  ) %>' 
                        Visible="False"></asp:Label>
                <asp:Label ID="lblSta" runat="server" Visible="False"></asp:Label>        
            </td>
            </tr>
            <tr>
            <td>
                <asp:Panel ID="Panel1" runat="server" Width="980px" Height="410px" ScrollBars="Auto">
                    <telerik:RadGrid 
                            ID="RadGrid1" 
                            runat="server" 
                            AllowAutomaticDeletes="True" 
                            AllowFilteringByColumn="True" 
                            AllowMultiRowEdit="True" 
                            AllowMultiRowSelection="True" 
                            AllowPaging="True" 
                            AllowSorting="True" 
                            AutoGenerateColumns="False" 
                            EnableAJAX="True" 
                            EnableAJAXLoadingTemplate="True" 
                            GridLines="None" 
                            OnItemCommand="RadGrid1_ItemCommand" 
                            Skin="Outlook" 
                            Width="950px" onitemcreated="RadGrid1_ItemCreated" 
                            onitemdatabound="RadGrid1_ItemDataBound" 
                            onneeddatasource="RadGrid1_NeedDataSource">
                            <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" 
                                ClientDataKeyNames="inquire_dtls_seq" 
                                CommandItemDisplay="Top" 
                                DataKeyNames="inquire_dtls_seq" 
                                InsertItemPageIndexAction="ShowItemOnCurrentPage" 
                                NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                <CommandItemTemplate>
                                    <table width="100%">
                                        <tr>
                                            <td>
                                                <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False" 
                                                    CommandName="InitInsert" 
                                                    
                                                    
                                                    Visible="<%# !RadGrid1.MasterTableView.IsItemInserted && RadGrid1.EditIndexes.Count <= 0 %>"> <img style="border:0px;vertical-align:middle;" alt="" 
                                        src="../Images/Buttons/AddRecord.gif" /> เพิ่มแบบแสดงความจำนง</asp:LinkButton>
                                               </td>
                                            <td align="right">
                                                
                                            </td>
                                        </tr>
                                    </table>
                                </CommandItemTemplate>
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="15px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                    <HeaderStyle Width="15px" />
                                </ExpandCollapseColumn>  
                             <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <GroupByFields>
                                    <telerik:GridGroupByField 
                                        FieldName="descr" 
                                        HeaderText="หัวข้อแบบแสดงความจำนง" />
                                </GroupByFields>
                                <SelectFields>
                                    <telerik:GridGroupByField 
                                        FieldName="descr" 
                                        HeaderText="หัวข้อแบบแสดงความจำนง :  "  
                                        HeaderValueSeparator = " "
                                        FieldAlias = "max"/>
                                </SelectFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>                          
                                <Columns>
                                <telerik:GridEditCommandColumn 
                                        EditText = "คลิกเพื่อแก้ไขรายการ"
                                        ButtonType="ImageButton">
                                        <HeaderStyle HorizontalAlign="Center" Width="15px" />
                                        <ItemStyle HorizontalAlign="Center" Width="15px" />
                                    </telerik:GridEditCommandColumn>
                                    <telerik:GridButtonColumn 
                                        ButtonType="ImageButton" 
                                        CommandName="Delete" 
                                        ConfirmDialogType="RadWindow" 
                                        ConfirmText="ลบข้อมูลที่เลือก?" 
                                        ItemStyle-Width="15" 
                                        Text="คลิกเพื่อลบรายการ" 
                                        UniqueName="column1">
                                        <HeaderStyle HorizontalAlign="Center" Width="15px" />
                                        <ItemStyle HorizontalAlign="Center" Width="15px"/>
                                    </telerik:GridButtonColumn>
                                    <telerik:GridBoundColumn Visible = "false"
                                        DataField="inquire_dtls_seq" 
                                        AllowFiltering = "false"
                                        ShowFilterIcon = "false"
                                        HeaderText="inquire_dtls_seq" 
                                        ReadOnly="True" 
                                        UniqueName="inquire_dtls_seq">
                                        <HeaderStyle HorizontalAlign="Center" Width="50px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="seq" 
                                        AllowFiltering = "false"
                                        ShowFilterIcon = "false"
                                        HeaderText="ลำดับที่" 
                                        ReadOnly="True" 
                                        UniqueName="Sequence">
                                        <HeaderStyle HorizontalAlign="Center" Width="50px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>                              
                                    <telerik:GridTemplateColumn
                                        HeaderText = "สังกัด"
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter="true" 
                                        CurrentFilterFunction="Contains" 
                                        ShowFilterIcon="False">                                
                                        <ItemTemplate>
                                            <%# Eval("job_site_name")%>                        
                                        </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="200px" />
                                    </telerik:GridTemplateColumn>

                                    <telerik:GridTemplateColumn
                                        DataField="reason"                                         
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderText="เหตุผล" 
                                        UniqueName="req_seq">
                                        <ItemTemplate>
                                            <%# Eval("reason")%> 
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" Width="200px" />                                        
                                    </telerik:GridTemplateColumn>

                                </Columns>
                                <EditFormSettings                                     
                                    EditFormType="WebUserControl" 
                                    UserControlName="../UserControls/ES_Inquire.ascx">
                                    <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
                                </EditFormSettings>
                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                            </MasterTableView><ClientSettings AllowColumnHide="True" 
                                AllowColumnsReorder="True" 
                                EnableRowHoverStyle="True" 
                                ReorderColumnsOnClient="True">
                                <Selecting AllowRowSelect="True" 
                                EnableDragToSelectRows="true" />
                                </ClientSettings>
                        </telerik:RadGrid>
                    </asp:Panel>
            </td>
            </tr>
            </table>
        </div>
        </div>
           
</asp:Content>